# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=parameterized
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.9.0
pkgrel=2
pkgdesc="Parameterized testing with any Python test framework (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
url='https://github.com/wolever/parameterized'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python-wheel")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-mock"
              "${MINGW_PACKAGE_PREFIX}-python-nose")
source=("https://pypi.io/packages/source/p/parameterized/parameterized-${pkgver}.tar.gz")
sha256sums=('7fc905272cefa4f364c1a3429cbbe9c0f98b793988efb5bf90aac80f08db09b1')

prepare() {
  rm -rf python-build-${MSYSTEM} || true
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}"
}

build() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  #${MINGW_PREFIX}/bin/python setup.py nosetests
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
